from dataclasses import dataclass

@dataclass
class book:
    name: str = 'unkonw'
    price: float = 10.0
    author: str = 'unkonw'
    number: int = 0

# 初始化方法1:
hero_book = book()

# 初始化方法2: 按顺序指定
sim_book = book("sim",20.0,"liuj",50)

# 初始化方法3: 指定参数
sim2_book: book = book(
    name = "sim2",
    price = 30.0,
    author = "liuj",
    number = 11
)

print(hero_book)
print(sim_book)
print(sim2_book)